
public class SimpleMakeParamFilter implements MakeParamFilter {

    private final static String[] DEFINE_BLACKLIST = {
            "KBUILD_BASENAME",
            "KBUILD_MODNAME",
            "__ASSEMBLY__",
            "__CHECK_ENDIAN__",
            "HAVE_AS_DSP",
    };
    
    @Override
    public boolean acceptDefine(StringItem item) {
        if(isInBlacklist(DEFINE_BLACKLIST, item.getValue(), false)) {
            return false;
        }
//        if(item.getRefCount() < 1000) {
//            return false;
//        }
        
        return true;
    }

    @Override
    public boolean acceptHeader(StringItem item) {
        return true;
    }
    
    private static boolean isInBlacklist(String[] blacklist, String value, boolean fullMatch) {
        for(String black : blacklist) {
            if(fullMatch) {
                if(black.equals(value)) {
                    return true;
                }
            } else {
                if(value.contains(black)) {
                    return true;
                }
            }
        }
        
        return false;
    }

}
